<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import { getUserInfo } from "@/api";
export default {
  name: "App",
  mounted() {
    this.initUserInfo();
  },
  methods: {
    async initUserInfo() {
      let res = await getUserInfo();
      if (res.code == 0) {
        this.$store.dispatch("user/setIsManager", res.data.isManager);
        if (res.data.isManager) {
          this.$store.dispatch("user/setUserInfo", res.data.manager);
        } else {
          this.$store.dispatch("user/setUserInfo", res.data.user);
        }
      }
    },
  },
};
</script>

<style lang="less" scoped>
</style>
